package crm.sfh.server;

import cn.bmob.v3.BmobObject;
import crm.sfh.server.entity.EMessage;

/**
 * 留言
 */
public class SMessage extends BmobObject {

    /**
     * 帖子ID
     */
    String noteId;

    /**
     * 发布者 Pointer类型，一对一关系
     */
    SUser author;

    /**
     * 点赞次数
     */
    Long sizeFabulous;

    /**
     * 留言内容
     */
    String content;

    public SUser getAuthor() {
        return author;
    }

    public void setAuthor(SUser author) {
        this.author = author;
    }

    public Long getSizeFabulous() {
        return sizeFabulous;
    }

    public void setSizeFabulous(Long sizeFabulous) {
        this.sizeFabulous = sizeFabulous;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getNoteId() {
        return noteId;
    }

    public void setNoteId(String noteId) {
        this.noteId = noteId;
    }

    public EMessage getEMessage() {
        EMessage eMessage = new EMessage();
        eMessage.setAuthor(author == null ? null : author.getUser());
        eMessage.setContent(content);
        eMessage.setCreateTime(getCreatedAt());
        eMessage.setMassId(noteId);
        eMessage.setMessageId(getObjectId());
        eMessage.setSizeFabulous(sizeFabulous == null ? 0L : sizeFabulous);
        return eMessage;
    }

}
